<?php
namespace app\lawcase\validate;

use think\Validate;

class LawcaseCheck extends Validate
{
    protected $rule = [
        // 'case_code' => 'require|max:20|unique:oa_lawcase',
        'contract_id' => 'integer',
        'court_id' => 'require|integer',
        'pid' => 'require|integer',
        'cid' => 'require|integer',
        'did' => 'require|integer',
        'case_cause_id' => 'require|integer',
        'stage' => 'require',
        'status' => 'require',
        'entrust_date' => 'require|date',
        'main_lawyer' => 'require|integer',
        'secondary_lawyer' => 'integer',
        'terminate_reason' => 'max:255'
    ];

    protected $message = [
        // 'case_code.require' => '案号不能为空',
        'case_code.max' => '案号长度不能超过20个字符',
        'case_code.unique' => '案号已存在',
        'court_id.require' => '管辖法院不能为空',
        'pid.require' => '所属省份不能为空',
        'cid.require' => '所属城市不能为空',
        'did.require' => '所属区县不能为空',
        'case_cause_id.require' => '案由不能为空',
        'stage.require' => '案件阶段不能为空',
        // 'stage.in' => '案件阶段值无效',
        'status.require' => '案件状态不能为空',
        //'status.in' => '案件状态值无效',
        'entrust_date.require' => '委托日期不能为空',
        'main_lawyer.require' => '主办律师不能为空',
        'terminate_reason.max' => '终止原因长度不能超过255个字符'
    ];

    protected $scene = [
        'add' => ['case_cause_id', 'stage', 'status', 'entrust_date'],
        'edit' => ['id', 'case_code', 'case_cause_id', 'stage', 'status', 'entrust_date']
    ];
}